Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR tries to fix the scanner error in https://github.com/vitejs/vite-ecosystem-ci/actions/runs/6401781367/job/17379560146#step:8:460 (plugin-vue).
This error was happening because
resolveDir
was not specified when resolving the script tag in Vue SFC.vite/packages/vite/src/node/optimizer/scan.ts
Line 446 in 673f529
vite/packages/vite/src/node/optimizer/scan.ts
Lines 362 to 364 in 673f529
So I added them.
But then this new error happened. This was happening because
onResolve
is not called for glob imports (evanw/esbuild#3317).https://github.com/vitejs/vite-plugin-vue/blob/e8503055b0ed29aa102b1f5b9a27f6b27a1f9713/playground/ssr-vue/src/pages/Home.vue#L31-L33
So I added a
onLoad
hook fornamespace: 'file'
.vite/packages/vite/src/node/optimizer/scan.ts
Lines 494 to 505 in 673f529
(TODO: check if this solves vitejs/vite-plugin-vue#253)And but then, this new error happend. This was happening because
extractImportPaths
was appendingimport '@vitejs/test-dep-import-type/deep'
to the content of script tag. (related PR: #5850)vite/packages/vite/src/node/optimizer/scan.ts
Lines 640 to 660 in 673f529
vite/packages/vite/src/node/optimizer/scan.ts
Lines 435 to 439 in 673f529
@vitejs/test-dep-import-type/deep
is a type only file and Vite fails to resolve that.I guess this is the same error with vitejs/vite-plugin-vue#24.
We can change the test in plugin-vue to use
import type
for now as it wasn't working from before.Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).